<template>
  <v-star ref="star" :config="config"> </v-star>
</template>
<script>
import Konva from 'konva';


export default {
  name: "XStarSpinner",
  props: {
    config: {
      type: Object
    }
  },

  mounted () {
    const angularSpeed = 90;
    // eslint-disable-next-line no-unused-vars
    const animate = (animatedLayer, star, frame) => {
      const angleDiff = (frame.timeDiff * angularSpeed) / 1000;
      //console.log(this.config.rotation, '旋转角度')
      star.rotate(angleDiff);
    }
    const star = this.$refs.star.getNode();
    const layer = star.getLayer();
    this.animation = new Konva.Animation((frame) => {
      animate(layer, star, frame);
    }, layer);

    this.animation.start();


  },


}
</script>
